package StudyCode.summary.Basic;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class TryWithResources {

	public static void main(String[] args) {
		String srcFile = "";
		String targetFile = "";

		// 复制文件
		try (FileInputStream inStream = new FileInputStream(srcFile);
		     FileOutputStream outStream = new FileOutputStream(targetFile);
		     FileChannel in = inStream.getChannel();
		     FileChannel out = outStream.getChannel()) {
			in.transferTo(0, in.size(), out);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
